// const { envList } = require('../../envList')
const api = require('../../api')

// pages/me/index.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    openId: '',
    showUploadTip: false,
    userInfo: wx.getStorageSync('userInfo')
  },

  //登录
  getOpenId() {
    console.log(this.data.userInfo)
    if (this.data.userInfo != null && this.data.userInfo != undefined && this.data.userInfo != '') {
      var jsonstr = JSON.stringify(this.data.userInfo)
      //已登录，用户详情页
      wx.navigateTo({ url: `/pages/user-center/person-info/index?userInfo=${jsonstr}` })
    } else {
      //登录页面跳转
      wx.navigateTo({ url: '/pages/login/index' })
      console.log('登录')
    }
  },
  //编辑或退出
  editOrquit() {
    if (this.data.userInfo != null && this.data.userInfo != undefined && this.data.userInfo != '') {
      var jsonstr = JSON.stringify(this.data.userInfo)
      //已登录，用户详情页
      wx.navigateTo({ url: `/pages/user-center/person-info/index?userInfo=${jsonstr}` })
    } else {
      //登录页面跳转
      wx.navigateTo({ url: '/pages/login/index' })
    }
  }
  //   gotoWxCodePage() {
  //     wx.navigateTo({
  //       url: `/pages/exampleDetail/index?envId=${envList?.[0]?.envId}&type=getMiniProgramCode`
  //     })
  //   }
})
